//
//  RealNameVerificationVC.m
//  MRBang
//
//  Created by 铅笔 on 15/12/17.
//  Copyright © 2015年 杭州易网新科技. All rights reserved.
//

#import "RealNameVerificationVC.h"

@interface RealNameVerificationVC ()<UITextFieldDelegate>

@property (nonatomic,strong) UITextField *textField_realName;
@property (nonatomic,strong) UITextField *textField_IDCardNo;

@property (nonatomic,strong) UIButton *button_realName;
@property (nonatomic,strong) UIButton *button_directoryLogin;

@end

@implementation RealNameVerificationVC

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"注册";
    self.view.backgroundColor = RXDColor(237, 243, 243);
    [self initWithAllSubviews];
}

#pragma mark --- 创建视图
- (void) initWithAllSubviews
{
    //真实姓名
    self.textField_realName = [[UITextField alloc] initWithFrame:CGRectMake(20, 84,kScreenWidth - 40, 40)];
    [self.view addSubview:self.textField_realName];
    self.textField_realName.placeholder = @"  输入真实姓名";
    self.textField_realName.layer.borderColor = RXDColor(205, 205, 207).CGColor;
    self.textField_realName.layer.borderWidth = 1.0;
    self.textField_realName.layer.cornerRadius = 3.0;
    self.textField_realName.clipsToBounds = YES;
    self.textField_realName.returnKeyType = UIReturnKeyNext;
    self.textField_realName.delegate = self;
    self.textField_realName.backgroundColor = [UIColor whiteColor];

    //身份证号
    self.textField_IDCardNo = [[UITextField alloc] initWithFrame:CGRectMake(20, self.textField_realName.frame.size.height+self.textField_realName.frame.origin.y+20,kScreenWidth - 40, 40)];
    [self.view addSubview:self.textField_IDCardNo];
    self.textField_IDCardNo.placeholder = @"  输入身份证号码";
    self.textField_IDCardNo.layer.borderColor = RXDColor(205, 205, 207).CGColor;
    self.textField_IDCardNo.layer.borderWidth = 1.0;
    self.textField_IDCardNo.layer.cornerRadius = 3.0;
    self.textField_IDCardNo.clipsToBounds = YES;
    self.textField_IDCardNo.returnKeyType = UIReturnKeyDone;
    self.textField_IDCardNo.delegate = self;
    self.textField_IDCardNo.backgroundColor = [UIColor whiteColor];
    
    //按钮
    [self initWithLabelAndButton];
}

//文字和 按钮
- (void) initWithLabelAndButton
{
    UILabel *label_text = [[UILabel alloc] initWithFrame:CGRectMake(20, self.textField_IDCardNo.frame.size.height+self.textField_IDCardNo.frame.origin.y+30, kScreenWidth-40, 20)];
    [self.view addSubview:label_text];
    label_text.text = @"申请信用卡、贷款需要实名认证请输入真实姓名及身份证号";
    label_text.font = [UIFont systemFontOfSize:10];
    label_text.textColor = RXDColor(80, 81, 81);
    
    //button realName
    self.button_realName = [[UIButton alloc] initWithFrame:CGRectMake(20, label_text.frame.size.height+label_text.frame.origin.y+5,kScreenWidth - 40, 40)];
    [self.view addSubview:self.button_realName];
    self.button_realName.backgroundColor = RXDColor(255, 118, 112);
    [self.button_realName setTitle:@"实名认证" forState:UIControlStateNormal];
    self.button_realName.layer.cornerRadius = 3.0;
    self.button_realName.clipsToBounds = YES;

    //直接登录
    self.button_directoryLogin = [[UIButton alloc] initWithFrame:CGRectMake(20, self.button_realName.frame.size.height+self.button_realName.frame.origin.y+10,kScreenWidth - 40, 40)];
    [self.view addSubview:self.button_directoryLogin];
    self.button_directoryLogin.backgroundColor = RXDColor(255, 153, 149);
    [self.button_directoryLogin setTitle:@"直接登录 稍后认证" forState:UIControlStateNormal];
    self.button_directoryLogin.layer.cornerRadius = 3.0;
    self.button_directoryLogin.clipsToBounds = YES;
}

//键盘退出
- (void) touchesEnded:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{
    [self.view endEditing:YES];
}
#pragma mark textfiled代理方法
-(BOOL)textFieldShouldReturn:(UITextField *)textField{
    [textField resignFirstResponder];
    return YES;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    
}

@end
